<template>
  <el-tree 
      :data="treeData" 
      :props="defaultProps" 
      @node-click="handleNodeClick"
      lazy
      ></el-tree>
</template>

<script lang="ts">
import { defineComponent, reactive } from "@vue/runtime-core";
export type NodeChildren = {
  label: string,
  children: Array<NodeChildren>
}
export default defineComponent({
  props: {
    treeData: {
      type: Array
    },
    defaultProps: {
      type: Object
    },

  },
  emits: ['handleNode'],
  setup(props, context) {
    const handleNodeClick = (data: NodeChildren) => {
      console.log('点击立', data)
        
      context.emit('handleNode', data)
    }
    return {
      handleNodeClick,
      // defaultProps
    }
  }
})
</script>

<style lang="scss" scoped>

</style>